@extends('admin.layout.layout', ['row' => @$page])

@section('contain')


    <div class="portlet">
        <div class="portlet-title">
            <div class="caption">
                <x-portlet-breadcrumb :page="$page"></x-portlet-breadcrumb>
            </div>
            <div class="actions"></div>
        </div>

        <div class="my-3 bg-light p-3 px-4">
            <div class="row">
                {{--<div class="col-auto">
                    <b>{{ ts('DEALERID') }}：</b>
                    <span>{{ @$user->unique_id }}</span>
                </div>--}}
                <div class="col-auto">
                    <b>{{ ts('dmmc') }}：</b>
                    <span>{{ @$user->company_name }}</span>
                </div>
                <div class="col-auto">
                    <b>{{ ts('PHONENUMBER') }}：</b>
                    <span>{{ @$user->phone_number }}</span>
                </div>
            </div>
        </div>

        <div class="filter-wrapper">
            <form action="/{{ request()->path() }}/" class="form-inline filter-form">
                <div class=" input-group mb-3 custom-control-inline">
                    <input type="text" class="form-control s-input" name="value" value="{{ request()->input('value') }}" placeholder="{{ ts('DEALERperformanceSEARCHTEXT') }}">
                </div>

                <x-p-f-select></x-p-f-select>
                {{--<x-film-type-select></x-film-type-select>--}}

                <x-flatpickr-date-range label="{{ ts('TGRQ') }}"></x-flatpickr-date-range>

                <div class="mb-3">
                    <button class="btn btn-primary">{{ ts('SEARCH') }}</button>
                    <a href="/{{ request()->path() }}/" class="btn btn-warning">{{ ts('RESET') }}</a>
                </div>

            </form>
        </div>

        <div>
            <table class="table text-center text-nowrap bt-table d-none">
                <thead>
                <tr class="order_column text-center">
                    {{--<th>{{ ts('sequence') }}</th>
                    <th data-field="roll_number" class="sortable {{ setOrderClass('roll_number') }}">{{ ts('rollnumber') }}</th>
                    <th data-field="film_type_id" class="sortable {{ setOrderClass('film_type_id') }}">{{ ts('FILMTYPE') }}</th>
                    <th data-field="length" class="sortable {{ setOrderClass('length') }}">{{ ts('LENGTH') }}</th>
                    <th data-field="warranty_id" class="sortable {{ setOrderClass('warranty_id') }}">{{ ts('WARRANTYID') }}</th>
                    <th data-field="installation_date" class="sortable {{ setOrderClass('installation_date') }}">{{ ts('DATESOLD') }}</th>
                    <th>{{ ts('zbxq') }}</th>--}}
                    <th data-field="index">{{ ts('sequence') }}</th>
                    {{--<th data-field="jxsmc" class="sortable {{ setOrderClass('jxsmc') }}">{{ ts('jxsmc') }}</th>--}}
                    <th data-field="roll_number" class="sortable {{ setOrderClass('roll_number') }}">{{ ts('rollnumber') }}</th>
                    <th data-field="film_type" class="sortable {{ setOrderClass('film_type') }}">{{ ts('FILMTYPE') }}</th>
                    <th data-field="length" class="sortable {{ setOrderClass('length') }}">{{ ts('ysycd') }}</th>
                    <th>{{ ts('wsycd') }}</th> {{-- data-formatter="btdf1"--}}
                    <th data-field="date_sold" class="sortable {{ setOrderClass('date_sold') }}">{{ ts('TGRQ') }}</th>
                    <th data-field="warranty_id" class="sortable {{ setOrderClass('warranty_id') }}">{{ ts('zbxq') }}</th>
                </tr>
                </thead>
                <tbody>
                @foreach($data as $k => $v)
                    <tr class="item-list">
                        <td>{{ @$data->firstItem()+$k }}</td>
                        <td>{{ $v->roll_number }}</td>

                        <td>{{ ts('film_type_master.'.$v->film_type_id) }}</td>

                        <td class="roll-sales-length">
                            {{ $v->length }} cm
                        </td>

                        <td>
                            {{ getRlenV401($v->roll_number, @$user->id) }} cm
                        </td>

                        <td>
                            {{ fdate(@$v->approved_date) }}
                        </td>
                        <td>
                            @if($v->warranty_id)
                                <a href="/admin/warranty/{{ $v->wid }}">{{ $v->warranty_id }}</a>
                            @endif
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>

            <div class="text-right my-3">
                <span class="alert alert-primary d-inline-block mb-0">
                    {{ ts('rollsalesstatistics') }}：
                    <span class="text-danger" style="font-weight: bold;letter-spacing: .4px">{{ (@$total/100) }} m</span>
                    {{--<span class="text-danger roll-saless-tatistics"></span>--}}
                </span>
            </div>
            <div class="my-3">
                {{ $data->appends(request()->input())->links() }}
            </div>
        </div>

    </div>


@endsection


@section('script')
<script>
    $(document).ready(function () {
        $('.table.bt-table').bootstrapTable({}).removeClass('d-none')
    })
</script>

@endsection
